package section3;

import java.io.BufferedInputStream;
import java.util.Arrays;
import java.util.Scanner;
public class PracticeI {
	private static Scanner sc = new Scanner(new BufferedInputStream(System.in));
	private static int i,n,m;
	private static Node[] nodes;
	public static void main(String[] args) {
		double sum;
		while(true){
			n = sc.nextInt();
			m = sc.nextInt();
			if(n+m==-2)
				break;
			nodes = new Node[m];
			for(i=0; i<m; i++){
				nodes[i] = new Node(sc.nextInt(),sc.nextInt());
			}
			Arrays.sort(nodes);
			sum = 0;
			for(i=0; i<m && n>0; i++){
				if(n>nodes[i].y){
					n = n - nodes[i].y;
					sum = sum + nodes[i].x;
				}else{
					sum = sum + n * 1.0 /nodes[i].y * nodes[i].x;
					n = 0;
				}
			}
			System.out.printf("%.3f",sum);
			System.out.println();
		}
	}
}
class Node implements Comparable<Node>{
	int x,y;
	double p;
	public Node(int x,int y){
		this.x = x;
		this.y = y;
		setP();
	}
	private void setP() {
		this.p = x * 1.0 / y;
	}
	@Override
	public int compareTo(Node n) {
		return (p<n.p)?1:-1;
	}
}
/*
 FatMouse' Trade
 
Sample Input
5 3
7 2
4 3
5 2
20 3
25 18
24 15
15 10
-1 -1
Sample Output
13.333
31.500

思路：这是一个典型的  贪心算法；

老鼠得到的数量要是最大：x/y的比率越大，对于老鼠来说越划算，所以应该尽可能的先计算比率大的；
 第一次：Memory Limit Exceeded   内存优化。。。难题啊 : 能用静态字段，尽量用静态字段；for循环尽量终止；私有属性还是去了吧； 尽量不使用-=类似操作符
 不管怎么优化，一直图片通不过。。。
 public class PracticeI {
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		DecimalFormat df = new DecimalFormat("#.000");
		int n,m;
		double sum;
		while(sc.hasNext()){
			n = sc.nextInt();
			m = sc.nextInt();
			if(n==-1 || m==-1)
				break;
			Node[] nodes = new Node[m];
			for(int i=0; i<m; i++){
				nodes[i] = new Node(sc.nextInt(),sc.nextInt());
			}
			Arrays.sort(nodes);
			sum = 0.0;
			for(int j=0; j<m; j++){
				if(n>nodes[j].getY()){
					n = n - nodes[j].getY();
					sum = sum + nodes[j].getX();
				}else{
					sum = sum + n * 1.0 /nodes[j].getY() * nodes[j].getX();
					n = 0;
				}
			}
			System.out.println(df.format(sum));
		}
	}
}
class Node implements Comparable<Node>{
	private int x;
	private int y;
	double p;
	public Node(int x,int y){
		this.x = x;
		this.y = y;
		setP();
	}
	public int getX() {
		return x;
	}
	public int getY() {
		return y;
	}
	private void setP() {
		this.p = x * 1.0 / y;
	}
	@Override
	public int compareTo(Node n) {
		return this.p<n.p?1:-1;
	}
}
 */


